.Rproj
RProjects and the here package
Leibniz-Zentrum Allgemeine Sprachwissenschaft
Wed Sep 25, 2024
Today we will…
here package4.4.0, “Puppy Cup”R.version2023.12.1.402, “Ocean Storm”.Rproj file in a project folderSoSe2024 or MastersarbeitFile > New Project > New Directory > New Project > [Directory name] > Create ProjectNew RProject
Create a new RProject for this workshop
File > New Project > New Directory > New Project > [Directory name] > Create Project.Rproj file and double-clickProject (None) drop-down (top right).Rproj
File > New File > Markdown File (not R Markdown!)
# for headings, *italics*, **bold**)README.md in your project directoryTools > Global Options
Global settings
Change your Global Options so that
data: containing your dataset(s)scripts (or analyses, etc.): containing any analysis scriptsmanuscript: containing any write-ups of your resultsmaterials: containing relevant experiment materials (e.g., stimuli)data and scripts)data/raw sub-folderprocessed or tidy)scripts/New script
Create a new Quarto script:
File > New File > Quarto DocumentUse Visual Editor boxCreatescripts/ folder: File > Save as...readr::read_csv()here-packagehere package (Müller, 2020) enables file referencing
setwd()Figure 7: Illustration by Allison Horst
setwd()If the first line of your R script is
setwd("C:\Users\jenny\path\that\only\I\have")I will come into your office and SET YOUR COMPUTER ON FIRE🔥.
setwd() depends on your entire machine’s folder structuresetwd() breaks when you
here()here
Load the dataset using here
here (e.g., install.packages("here"))here at the beginning of your package
here:: before calling a functionhere() function to load in your datasummary(), names(), etc.)here::here()here functionhere function without loading the packagedf_
df stands for dataframefit_ for models, fig_ for figures, sum_ for summaries, tbl_ for tables, etc.Reproduce your analysis
names(), summary(), dplyr::glimpse(), whatever you typically do)Today we learned…
here ✅HU Phonetics